package com.itheima.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.List;

@Mapper
public interface ReportDao {
    Integer selectMemberCount(LocalDate localDate);

    @Select("select s.name from t_order o left join t_setmeal s on o.setmeal_id = s.id group by s.name")
    List<String> selectSetmealNames();

    @Select("select s.name from t_order o left join t_setmeal s on o.setmeal_id = s.id group by s.name order by count(o.setmeal_id) desc limit 0,4;")
    List<String> selectSetmealNamesLimit4();


    Integer selectSetmealCountByName(String setmealName);

    Integer selectMemberCountReport(LocalDate localDate);

    Integer selectOrderReport(LocalDate localDate);

    Integer selectVisitsReport(LocalDate now);

    @Select("select count(*) from t_order")
    Integer selectSetmealReport();
}
